package com.pubinfo.passbook.common.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.pubinfo.passbook.common.handler.engine.ComputeChainParamListTypeHandler;
import com.pubinfo.passbook.common.model.dto.engine.EngineDescription;
import com.pubinfo.passbook.common.model.http.engine.ComputeChainParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.util.Collection;

/**
 * 计算链PO
 *
 * @author zhouch
 * @date 2021/12/10 16:54
 */
@TableName(autoResultMap = true)
@Data
@NoArgsConstructor
@ApiModel("计算链")
public class TEngineComputeChain {

    @TableId(type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty("计算链名称")
    @NotBlank(message = "计算链名称不能为空")
    private String name;

    /**
     * 计算链类型
     * {@link com.pubinfo.passbook.engine.constants.ComputeChainType}
     */
    @ApiModelProperty(EngineDescription.COMPUTE_CHAIN_TYPE)
    @NotBlank(message = "计算链类型不能为空")
    private String type;

    @ApiModelProperty("描述")
    @NotBlank(message = "计算链描述不能为空")
    private String description;

    @ApiModelProperty("计算链体")
    @NotEmpty(message = "计算链体不能为空")
    @TableField(typeHandler = ComputeChainParamListTypeHandler.class)
    // @TableField(typeHandler = FastjsonTypeHandler.class)
    private Collection<ComputeChainParam> body;

    @ApiModelProperty("绑定地区")
    private String districtId;
}
